Skip to content

hooks, handler: Add tests for failing pre-create callbacks - #1419

Merged
Acconut merged 1 commit into
mainfrom
test/precreate-callback-errors
Nov 20, 2026
Merged

Acconut merged 1 commit into
mainfrom
test/precreate-callback-errors

Conversation

@Acconut

@Acconut Acconut commented Nov 20, 2026

Copy link
Copy Markdown
Member

Adds test coverage for errors from the pre-create hook/callback, which was previously untested:

  • pkg/hooks: TestNewHandlerWithHooks now also checks that when InvokeHook returns an error for pre-create, PreUploadCreateCallback returns that error together with an empty HTTPResponse and FileInfoChanges.
  • pkg/handler: new TestPost/PreUploadCreateCallbackError subtests check that a failing PreUploadCreateCallback rejects the POST without calling the store's NewUpload:
    • a plain error results in 500 ERR_INTERNAL_SERVER_ERROR,
    • a handler.Error (ErrUploadRejectedByServer with a custom response) has its status, body and headers passed through,
    • the same applies to upload creation via the experimental protocol (PostFileV2).

Test-only change; no production code is modified.

@Acconut
Acconut merged commit a150da3 into main Nov 20, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant